//
//  PYError.m
//  Piaoyoung
//
//  Created by LiTengFei on 15/6/2.
//  Copyright (c) 2015年 HangZhou PiaoYoung Co.Ltd. All rights reserved.
//

#import "PYError.h"

@implementation PYError

@synthesize error;

+ (instancetype)networkError {
    PYError *error = [PYError errorWithCode:404 message:@"网络连接错误"];
    return error;
}

+ (instancetype)tokenUnVaildError {
    PYError *error = [PYError errorWithCode:-100 message:@"token过期"];
    return error;
}

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {

}
+ (instancetype)errorWithDictionary:(NSDictionary *)dictionary {
    return [[PYError alloc] initWithDictionary:dictionary];
}

- (instancetype)initWithCode:(NSInteger)code message:(NSString *)message {
    self = [super init];
    if (self) {
        _errorCode = code;
        _message = message;
    }
    return self;
}

+ (instancetype)errorWithCode:(NSInteger)code message:(NSString *)message {
    PYError *error = [[PYError alloc] initWithCode:code message:message];
    return error;
}

@end
